home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_06 / pjp / tiostrea.c < prev   
C/C++ Source or Header  |  1995-04-06  |  1KB  |  39 lines

  1. ------------- Listing 3: The file tiostrea.c ------------------
  2.  
  3.  
  4. // test <iostream>
  5. #include <assert.h>
  6. #include <iostream>
  7. #include <iostream>
  8.  
  9. int main()
  10.     {       // test basic workings of iostream definitions
  11.     assert(cin.good() && cin.exceptions() == ios::goodbit
  12.         && cin.flags() == (ios::skipws | ios::dec)
  13.         && cin.precision() == 6 && cin.width() == 0
  14.         && cin.fill() == ' ');
  15.     assert(cout.good() && cout.exceptions() == ios::goodbit
  16.         && cout.flags() == (ios::skipws | ios::dec)
  17.         && cout.precision() == 6 && cout.width() == 0
  18.         && cout.fill() == ' ');
  19.     assert(cerr.good() && cerr.exceptions() == ios::goodbit
  20.         && cerr.flags()
  21.             == (ios::skipws | ios::dec | ios::unitbuf)
  22.         && cerr.precision() == 6 && cerr.width() == 0
  23.         && cerr.fill() == ' ');
  24.     assert(clog.good() && clog.exceptions() == ios::goodbit
  25.         && clog.flags() == (ios::skipws | ios::dec)
  26.         && clog.precision() == 6 && clog.width() == 0
  27.         && clog.fill() == ' ');
  28.     cout << "Can write on streams:" << endl;
  29.     cout << "\tcout" << endl;
  30.     cerr << "\tcerr" << endl;
  31.     clog << "\tclog" << endl;
  32.     assert(cout.good());
  33.     assert(cerr.good());
  34.     assert(clog.good());
  35.     cout << "SUCCESS testing <iostream>" << endl;
  36.     return (0);
  37.     }
  38.  
  39.